import subprocess
import os
import csv

def get_columns():
    ret = []
    for r, d, files in os.walk('./scripts'):
        for script_name in files:
            if not script_name.endswith('.py'):
                continue
            cols = script_name[:-3].split('$')
            ret.extend(cols)
    return ret

#binary path
path = "//vermouth/homes/pozga/My Documents/class/cs490/test code/bin"
path = os.path.normpath(path)

row = ['algorithm']
row.extend(get_columns())

with open("data.csv", 'w', newline='') as f:
    writer = csv.writer(f)
    writer.writerow(row)

for r, d, files in os.walk(path):
    for filename in files:

        if filename.endswith('.idb'):
            continue
       
        filepath = os.path.join(r,filename)
        subprocess.call(["C:\\Program Files (x86)\\IDA 6.3\\idaw"
                        , '-A'
                        , '-SIDA_Plugin.py'
                        ,  filepath])